// miniprogram/pages/result/result.js
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    var result = wx.getStorageSync('result');
    this.setData({
      result: result
    })


      var phone = wx.getStorageSync('phone');
      var dishi = wx.getStorageSync('province');
      var sex = wx.getStorageSync('sex');
      var nature = wx.getStorageSync('nature');
      var status = wx.getStorageSync('status');
      var edu = wx.getStorageSync('edu');
      var zy = wx.getStorageSync('zy');

        wx.request({ //发送请求
          url: "https://zg99.offcn.com/index/chaxun/getlist/?actid=35388&callback=?",
          data: {
            xl: edu,
            lylb: nature,
            zy: zy,
            limits: '100'
          }, //接收参数
          success(res) { //返回
            var jsonStr = res.data;
            jsonStr = jsonStr.replace("(", "");
            jsonStr = jsonStr.replace(")", "");
            if (typeof jsonStr != 'object') {
              jsonStr = jsonStr.replace(/\ufeff/g, ""); //字符串转化JSON对象
              var theJson = JSON.parse(jsonStr);
            };
            // console.log(theJson)
            if (theJson.status == '2') {
              console.log('暂无数据！')
              wx.showToast({
                title: '暂无数据',
                icon: 'none',
                duration: 2000
              })
            } else {
              that.setData({
                theList: theJson.lists
              })
            }
            // console.log(that.data.theList)
          }
        })
    
  
  },
  toxq: function (e) {
    var that = this;
    // console.log(e.currentTarget.dataset.res)
    wx.setStorageSync('xq', e.currentTarget.dataset.res);
    wx.navigateTo({
      url: '../xq/xq',
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})